Add a partition to the database.
URL Parameters | |
---|---|
format |
The format of the data in the request body. Can be either
json , or xml . Use this parameter to override
the Content-type header.
|
Upon success, MarkLogic server returns status code 201 (Created).
manage-admin
role, or the
following privilege:
http://marklogic.com/xdmp/privileges/manage-admin
You must define the partition key and assignment policy of the database before creating a partition. For details, see Configuring a Database to Participate in Tiered Storage in the Administrator's Guide.
The partition configuration in the POST body must contain at least the
partition-name
, lower-bound
,
upper-bound
, forests-per-host
, and
host
elements or keys. For more details and a list
of available options,
see tieredstorage:partition-create
.
The structure of the data in the request body is as follows:
partition-name
upper-bound
lower-bound
forests-per-host
hosts
This is a complex structure with the following children:
host
replicas
data-directory
large-data-directory
fast-data-directory
options
This is a complex structure with the following children:
option
The following configuration shows all possible fields. $ cat add-partition.xml ==> <partition xmlns="http://marklogic.com/manage"> <partition-name>2011</partition-name> <lower-bound>2011-01-01</lower-bound> <upper-bound>2011-12-31</upper-bound> <forests-per-host>1</forests-per-host> <hosts> <host>host-1</host> <host>host-2</host> </hosts> <data-directory></data-directory> <large-data-directory></large-data-directory> <fast-data-directory></fast-data-directory> <options> <option>failover=none</option> </options> </partition> $ curl --anyauth --user user:password -X POST -d @./add-partition.xml \ -i -H "Content-type: application/xml" \ http://localhost:8002/manage/v2/databases/example-db/partitions ==> A new partition named "2011" is created for example-db. Forests 2011-0001 and 2011-0002 are created, one on each named host. MarkLogic Server responds with headers similar to the following. HTTP/1.1 201 Created Cache-Control: no-cache Expires: -1 Location: /manage/v2/databases/13475778675412262560/partitions/2011 Server: MarkLogic Set-Cookie: SessionID=d647d71d2ffc55d6; path=/ Content-Length: 0 Connection: Keep-Alive Keep-Alive: timeout=5
$ cat add-partition.json ==> { "partition-name": "2012", "lower-bound": "2012-01-01", "upper-bound": "2012-12-31", "forests-per-host": 1, "host": [ "host-1", "host-2" ], "option": [ "failover=none" ] } $ curl --anyauth --user user:passowrd -X POST -d @./add-partition.json \ -i -H "Content-type: application/json" http://localhost:8002/manage/v2/databases/example-db/partitions ==> A new partition named "2012" is created for example-db. Forests 2012-0001 and 2012-0002 are created, one on each named host. MarkLogic Server responds with headers similar to the following. HTTP/1.1 201 Created Cache-Control: no-cache Expires: -1 Location: /manage/v2/databases/13475778675412262560/partitions/2012 Server: MarkLogic Set-Cookie: SessionID=53f1ed9b18ed7196; path=/ Content-Length: 0 Connection: Keep-Alive Keep-Alive: timeout=5